// 导入组件
import Vue from 'vue';
import Router from 'vue-router';
// 登录
import login from '@/views/login';
// 首页
import index from '@/views/index';


// 用户管理
import User from '@/views/system/user';
// 菜单管理
import Module from '@/views/system/Module';
// 角色管理
import Role from '@/views/system/Role';
//单位管理
import Dept from '@/views/system/Dept';


// 管理员功能
// 申请清单
import Application from '@/views/manage/applicationsList/index.vue';

// 租户 租户信息
import PersonalInformation from '@/views/tenant/personalInformation.vue';
// 租户 数据库信息
import DatabaseInformation from '@/views/tenant/databaseInformation.vue';
// 租户 资源申请情况
import ResourceApplication from '@/views/tenant/resourceApplication.vue';
//申请模板
import ApplicationTemplate from '@/views/manage/ApplicationTemplate/index.vue';
// 数据资源情况
import DataResources from '@/views/manage/DataResources/index.vue';


//监控中心
import MonitoringCenter from '@/views/MonitoringCenter/index.vue';
// 启用路由
Vue.use(Router);
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch((err) => err)
}

// 导出路由 
export default new Router({
    routes: [{
        path: '/',
        name: '',
        component: login,
        hidden: true,
        meta: {
            requireAuth: false
        }
    }, {
        path: '/login',
        name: '登录',
        component: login,
        hidden: true,
        meta: {
            requireAuth: false
        }
    }, {
        path: '/index',
        name: '首页',
        component: index,
        iconCls: 'el-icon-tickets',
        children: [{
            path: '/user',
            name: '用户管理',
            component: User,
            meta: {
                requireAuth: true
            }
        }, {
            path: '/Module',
            name: '菜单管理',
            component: Module,
            meta: {
                requireAuth: true
            }
        }, {
            path: '/Role',
            name: '角色管理',
            component: Role,
            meta: {
                requireAuth: true
            }
        }, {
            path: '/dept',
            name: '单位管理',
            component: Dept,
            meta: {
                requireAuth: true
            }
        }, {
            path: '/application',
            name: '资源申请单',
            component: Application,
            meta: {
                requireAuth: true
            }
            
        }, {
            path: '/ApplicationTemplate',
            name: '资源申请模板',
            component: ApplicationTemplate,
            meta: {
                requireAuth: true
            }

        }, {
            path: '/DataResources',
            name: '数据资源情况',
            component: DataResources,
            meta: {
                requireAuth: true
            }
        }, {
            path: '/MonitoringCenter',
            name: '监控中心',
            component: MonitoringCenter,
            meta: {
                requireAuth: true
            }

        },
        {
            path: '/PersonalInformation',
            name: '个人信息',
            component: PersonalInformation,
            meta: {
                requireAuth: true
            }

        },
        {
            path: '/DatabaseInformation',
            name: '数据库信息',
            component: DatabaseInformation,
            meta: {
                requireAuth: true
            }

        },
            {
                path: '/ResourceApplication',
                name: '资源申请情况',
                component: ResourceApplication,
                meta: {
                    requireAuth: true
                }

            },

        ]
        }] 
})